#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

struct student {
    int num;
    char name[20];
    int score[3];
    int total[3];
};

struct student stu[3];

void test1();

void test2();

void test3();

int fun();

int maxes();

int main() {

    for (int i = 0; i < 3; ++i) {
        printf("序列：");
        scanf("%d", &stu[i].num);
        printf("姓名：");
        scanf("%s", stu[i].name);
        printf("成绩：");
        scanf("%d %d %d", &stu[i].score[i], &stu[i].score[i], &stu[i].score[i]);
    }

    for (int i = 0; i < 3; ++i) {
        stu[i].total[i] = stu[i].score[i] + stu[i].score[i] + stu[i].score[i];
        printf("序列： %d 姓名： %s 成绩： %d %d %d 总成绩： %d\n", stu[i].num, stu[i].name, stu[i].score[i], stu[i].score[i],
               stu[i].score[i], stu[i].total[i]);
    }

    int max;
    maxes(stu->num, &max);

    while (stu->num) {
        printf("输入序号：");

    }

}

void test3() {

//    struct student stu[3];

    for (int i = 0; i < 3; ++i) {
        printf("序列：");
        scanf("%d", &stu[i].num);
        printf("姓名：");
        scanf("%s", stu[i].name);
        printf("成绩：");
        scanf("%d %d %d", &stu[i].score[i], &stu[i].score[i], &stu[i].score[i]);
    }

    for (int i = 0; i < 3; ++i) {
        stu[i].total[i] = stu[i].score[i] + stu[i].score[i] + stu[i].score[i];
        printf("序列： %d 姓名： %s 成绩： %d %d %d 总成绩： %d\n", stu[i].num, stu[i].name, stu[i].score[i], stu[i].score[i],
               stu[i].score[i], stu[i].total[i]);
    }

    /* int total[3];
     fun(stu,total);*/

    /* for (int i = 0; i < 3; ++i) {
         stu[i].total[i] = stu[i].score[i] + stu[i].score[i] + stu[i].score[i];
         printf("%d\t", stu[i].total[i]);
     }*/

    int max;
    maxes(stu->num, &max);

    while (stu->num) {
        printf("输入序号：");

    }
}

int maxes(struct student *stu, int *total) {
    int temp = total[0];
    for (int i = 0; i < 3; ++i) {
        if (total[i] > temp) {
            temp = total[i];
        }
    }
//    *max = temp;
}

int fun(struct student *stu, int *total) {

    total[0] = stu[0].score[0] + stu[0].score[1] + stu[0].score[2];

    total[1] = stu[1].score[0] + stu[1].score[1] + stu[1].score[2];

    total[2] = stu[2].score[0] + stu[2].score[1] + stu[2].score[2];

}

void test2() {
    struct student {
        int age;
        char name[20];
        char add[20];
        float score;
    };

    struct student stu[100];

    for (int i = 0; i < 3; ++i) {
        printf("年龄：");
        scanf("%d", &stu[i].age);
        printf("姓名：");
        scanf("%s", stu[i].name);
        printf("地址：");
        scanf("%s", stu[i].add);
        printf("成绩：");
        scanf("%f", &stu[i].score);
    }

    for (int i = 0; i < 3; ++i) {
        printf("%d %s %s %f \n", stu[i].age, stu[i].name, stu[i].add, stu[i].score);
    }
}

void test1() {
    struct student {
        int age;
        char name[20];
        char add[20];
        float score;
    };

    struct student stu;
    stu.age = 100;
    strcpy(stu.name, "lili");
    strcpy(stu.add, "beijing");
    stu.score = 100.099;

    printf("%d %s %s %f \n", stu.age, stu.name, stu.add, stu.score);

    scanf("%d %s %s %f", &stu.age, stu.name, stu.add, &stu.score);

    printf("%d %s %s %f", stu.age, stu.name, stu.add, stu.score);
}
